<%--
 *  File:    ZylAllGoalsPlanSummary.jsp
 *  @Author: jackwang 
 *  Date:    2012/11/15
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into 
 *  with Oval. 
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.ZylAllGoalsPlanSummary"); 
%>

<% //--------------------------------------  variant and initialization --%>
<%
    String strModuleName = "PCM";
  	String strTableName = "";
  	String privilegeCode = "APP01,A01402,A01403,A01404,A01405,A011007,A011008,A011009,A011017,A011018,A011019";
    String contextPath = request.getContextPath(); 
%>



<%
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>ZylApprovalFailSummary</title>
<PageFlow:CheckPageFlow pageName="zylapprovalfailsummary1"/>
<%@ include file="/inc/InitEdit.inc"%>
<%
  java.util.Vector allMyErrorCode = (java.util.Vector)session.getAttribute("myerrorcode");
  //System.out.print(allMyErrorCode);
  if(allMyErrorCode != null && allMyErrorCode.size() != 0)  
  {
	 session.setAttribute("errorcode",allMyErrorCode);
	 session.removeAttribute("myerrorcode");
	 response.sendRedirect("/" + ConstantProp.DEFAULT_WAR_NAME + "/Error.jsp?" + OvalTools.randomURL() + "");
	 return;
  }
%>
<%@ include file="/inc/CatchError.inc"%>
<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector userGroupSummary = (Vector)pageContext.getAttribute("ugsummary");
  	if(userGroupSummary == null)
  	{
    	userGroupSummary = new Vector();
  	}
  	String subjectcode = (String)pageContext.getAttribute("subjectcode");
  	String isfirst="";
  	Integer standardtype=new Integer(-1);
	if(pageContext.getAttribute("isfirst") != null){
		isfirst = (String)pageContext.getAttribute("isfirst");
	}
	if(pageContext.getAttribute("standardtype") != null){
		standardtype = (Integer)pageContext.getAttribute("standardtype");
	}
	//out.print("standardtype="+standardtype);
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>



function page_clear(){
	document.getElementById("stdareaid").value="";
	document.getElementById("strareaname").value="";
    document.getElementById("deptid").options[0].selected=true;

}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(usergroupsummaryform,actionvalue,orderbyname);
  var subjectcode =usergroupsummaryform.subjectcode.value;
  editform.action = "ZylAllGoalsPlanSummary.jsp?<%= OvalTools.randomURL() %>"+"&subjectcode="+subjectcode;
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}



function allcheckselect(){
	var allcheck = usergroupsummaryform.checkallbox.checked;
	var alldatafile = document.getElementsByName('batchnoidstr');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
		    if(!alldatafile[i].disabled){
			  alldatafile[i].checked=true;
		    }
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

function page_update(){
	
	    if(isNullChecked(usergroupsummaryform.batchnoidstr))
	    {
	        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
	        return;
	    }
	    
		document.usergroupsummaryform.actionname.value = "update";
		document.usergroupsummaryform.target = "_self";
	    isRunning = true;
		document.usergroupsummaryform.submit();
}

function page_agree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "agree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_disagree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "disagree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_report(){
	
    if(isNullChecked(usergroupsummaryform.batchnoidstr))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }
    var currentnum = document.usergroupsummaryform.currentnum.value;
	document.usergroupsummaryform.actionname.value = "report";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}
function page_approval()
{
 if(isNullChecked(usergroupsummaryform.batchnoidstr))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }
var frm = document.usergroupsummaryform;
 
  frm.actionname.value = "approve";
  frm.target = "_self";
  isRunning = true;
  frm.submit();

}
function page_popBusinessarea()
{
  if (typeof popwindow != 'undefined') popwindow.close();
  popwindow = window.open("<%=contextPath%>/masterdata/ogm/zylstdbusinessareapop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
	
}

function setContact(id,type,name){
	document.getElementById("stdareaid").value=id;
	document.getElementById("strareaname").value=name;
}

function page_report2(){
	
    if(isNullChecked(usergroupsummaryform.batchnoidstr))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "report2";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_done(a_str){ 
    if(isNullChecked(document.usergroupsummaryform.batchnoidstr))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }
    if(a_str=="agree")
    {
     document.usergroupsummaryform.actionname.value = "agree";
    }else if(a_str=="deny"){
        document.usergroupsummaryform.actionname.value = "deny";
    }else if(a_str=="stop"){
        document.usergroupsummaryform.actionname.value = "stop";
    }else{
      return;
    }
    document.usergroupsummaryform.target = "_self";
    isRunning = true;
    document.usergroupsummaryform.submit();
}
function clickProd(id,num)
{ 
  if(num != null || num == ''){
		document.usergroupsummaryform.currentnum.value=num;
  }else{
 	 	document.usergroupsummaryform.currentnum.value='';
  }
  var radio = document.getElementsByName('batchnoidstr');
  if(!radio[num].disabled){
    radio[num].checked=true;
  }
}
function clickProd2(unit,num)
{ 
  if(num != null || num == ''){
		document.usergroupsummaryform.currentnum.value=num;
  }else{
 	 	document.usergroupsummaryform.currentnum.value='';
  }
  var radio = document.getElementsByName('batchnoidstr');
  if(!radio[num].disabled){
    radio[num].checked=true;
  }
}
</script>
</head>
<% //if(!("N".equals(isfirst))){ %>
 <!-- <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="javascript:page_summary('search')"> -->
<%//}else{ %>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%//}%>
	<% //--------------------------------------  hidden form variant --%>
	<form name="usergroupsummaryform" method="post" action="<%=contextPath %>/Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="zylapprovalfailsummary1">
    <input type="hidden" name="actionname">
    <input type="hidden" name="numrows" value="<%=userGroupSummary.size() %>">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <input type="hidden" name="subjectcode" value="<%=subjectcode %>">
 <%
    String strLanguageCode0;
    String strLanguageCode1; 
    if(strLanguageCode.equalsIgnoreCase("cn"))
    {
  	strLanguageCode0 = "cn";
  	strLanguageCode1 = "en";
    }else{
  	strLanguageCode0 = "en";
  	strLanguageCode1 = "cn";
    }
  %>
  <input type="hidden" name="languagecode0" value="<%= strLanguageCode0 %>">
  <input type="hidden" name="languagecode1" value="<%= strLanguageCode1 %>">
  <input type="hidden" name="languagecode2" value="<%= strLanguageCode0 %>">
  <input type="hidden" name="languagecode3" value="<%= strLanguageCode1 %>">
  <input type="hidden" name="entitytype0" value="NT">
  
  <input type="hidden" name="entitytype1" value="NT">
  <input type="hidden" name="entitytype2" value="NC">
  <input type="hidden" name="entitytype3" value="NC">
  <input type="hidden" name="content0">
  <input type="hidden" name="content1">
  <input type="hidden" name="content2">
  <input type="hidden" name="content3">
  <input type="hidden" name="currentnum">
  <custom:hidden property="isfirst" value="N"/>
  <custom:hidden property="standardtype" />
  <custom:hidden name="userinfo" property="orgid" scope="session"/>
  <custom:hidden name ="userinfo" property ="userid" scope="session" changedName="fromuserid"/>
    
   

	<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
	
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
  	<tr> 
    	<td valign="top"> 
    		<table width="100%" border="0" cellspacing="0">
          	<tr><td class="summary_top" ></td></tr>
          	<tr>
          	    <td style="text-align:right"><%= label.getLabelName("L_Year1") + label.getLabelName("L_Colon") %></td>
          	    <td><custom:selectdic property="year" dictType="Years" label="L_Year1" /></td>
             	<td style="text-align:right"><%= label.getLabelName("L_Quarter") + label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic dictType="Quarter" property="quarter"  /></td>
          	    <td style="text-align:right"><%= label.getLabelName("L_Department") + label.getLabelName("L_Colon") %></td>
          	    <td><custom:select property="deptid" optionsName="alldepts" optionValueKey="deptid" optionInnerTextKey="deptname" /></td>
			    <td style="text-align:right"><%= label.getLabelName("L_Provicetdr") + label.getLabelName("L_Colon") %></td>
				<td><custom:hidden property="stdareaid" /><custom:text property="strareaname"/><a onclick="page_popBusinessarea();">
				<custom:button type="3" value="*"/></a>
				</td>
				<td style="text-align:left"><a href="javascript:page_summary('search')"><img src="/oval/images/cn/go_fy.gif" border="0" style="border: 1 solid #000000"></a>&nbsp;&nbsp;
				<button button type="button" onclick="page_clear()" class="button1" name="re" value="clear"><%= label.getLabelName("L_Clear") %></button>
				</td>
			 </tr>
        	</table>
        </td>
   	</tr>
   	</table>
    <%if(standardtype.intValue()==1){ %><!-- 省区标准 -->
   	<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="0">
   
   	<% //--------------------------------------  summary header --%>
   	<tr bgcolor="#ACBCCA"  class="deepblue-left" > 
   		<td width="1%" class="title_center" >
   		  <!-- <input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"> -->
   		  <%if(userGroupSummary.size() > 0){ %>
			&nbsp;<input type="checkbox" name="checkallbox" class="checkbox"  onclick="allcheckselect()">
		  <%}else{ %>
			&nbsp;
		  <%} %>
   		</td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_Provicetdr") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_Department") %></td>
       	<td width="6%" class="title_center" ><%= label.getLabelName("L_RegionOffice") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_Manager") %></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_Grade") %></td>
       	<td width="7%" class="title_center" ><%= label.getLabelName("L_Variety") %></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_LockNumber") %></td>
       	<td width="8%" class="title_center" ><%= label.getLabelName("L_PlanAndDevelopedNumber") %></a></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_PlanNumber") %></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_DeptNumber") %></td>
       	<%if((JspHelper.filterNull( subjectcode ).equals("920")) ||  (JspHelper.filterNull( subjectcode ).equals("921"))  ) { %>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_DifferenceNumber") %></td>
       	<%} %>
       	<td width="6%" class="title_center" ><%= label.getLabelName("L_TurnoverTime") %></td>
    </tr>

	<% //--------------------------------------  default value definition --%>
    <%
    	int i=1;
        Integer nDefaultbatchno = new Integer(-1);               
        String strClassType = new String(); 
        boolean bHasChecked = false;
        String strDefaultIsDisabled="";
        String strDefaultmdapprovalgroupname=""; 
        String nDefaultbatchcode = "";
   	%>
   	
    <% //--------------------------------------  loop results --%>
    <logic:iterate id="usergroup" collection="<%= userGroupSummary %>" indexId="idx">                      
    	
    <%
    	HashMap userGroupMap = (HashMap)pageContext.getAttribute("usergroup"); 
        String strIsDisabled = "";
        String strIsChecked = "";
        boolean selectDisabled1=true;
        //out.print(((Integer)userGroupMap.get("count40")).intValue()!=0);
        if((JspHelper.filterNull( subjectcode ).equals("920")) ||  (JspHelper.filterNull( subjectcode ).equals("921"))  ) {
        	/*
           if(((Integer)userGroupMap.get("lowercount40")).intValue()!=0){
        	if(((Integer)userGroupMap.get("count20")).intValue()==0){
             if(((Integer)userGroupMap.get("lowercount20")).intValue()==0){
          	    selectDisabled1=false;
             }
        	}
           }*/
           //1.部门标准为空、为合格 多选框置灰 2，不合格置灰
           if(userGroupMap.get("deptcount")!= null){
           	 if(((Integer)userGroupMap.get("differencetype")).intValue()==1){
           	   selectDisabled1=false;
             }
           }
        }
        if((JspHelper.filterNull( subjectcode ).equals("820")) ||  (JspHelper.filterNull( subjectcode ).equals("821"))  ) {
            if(((Integer)userGroupMap.get("lowercount20")).intValue()!=0){
          	    selectDisabled1=false;
            }
        }
        if(i%2==0){
            strClassType="td-listrom";
        } else{
            strClassType="none";
        } 
       if(!bHasChecked)
        {
	        strIsChecked = "Checked";                       
            bHasChecked = true;
          	strDefaultIsDisabled = strIsDisabled;   
        }  
       i++;
  	%>
  	
  	
    <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"   class="<%=JspHelper.filterNull( strClassType )%>">
    	<td class="title_center">
    	  &nbsp;<custom:checkbox property="busprostr" name="usergroup" changedName="batchnoidstr" styleClass="normalradio" disabled="<%=selectDisabled1 %>" />
        </td>
        <!--终端计划审批-->
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("area1name") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("deptname") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("area2name") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("employeename") )%></td>
        <%if((JspHelper.filterNull( subjectcode ).equals("820")) || (JspHelper.filterNull( subjectcode ).equals("920")) ) {%>
          <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("organalysisattr2") )%></td>
        <%} %>
        <%if((JspHelper.filterNull( subjectcode ).equals("821")) || (JspHelper.filterNull( subjectcode ).equals("921")) ) {%>
          <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("organalysisattr3") )%></td>
        <%} %>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("productgroupname") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("allamount") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("plandevelopedcount") )%></td>
        <%if((JspHelper.filterNull( subjectcode ).equals("820")) || (JspHelper.filterNull( subjectcode ).equals("821")) || (JspHelper.filterNull( subjectcode ).equals("920")) ||  (JspHelper.filterNull( subjectcode ).equals("921"))  ) {%>
        <td class="title_center">&nbsp;<a href="<%=contextPath %>/zylprocessgoals/ApprovalZylReportPlanDetail.jsp?<%= OvalTools.randomURL() %>&businessareaid=<%=JspHelper.filterNull( userGroupMap.get("businessareaid") )%>&subjectcode=<%=subjectcode %>&contactid=<%=JspHelper.filterNull( CurUserInfo.get("userid") )%>&productgroupid=<%=JspHelper.filterNull( userGroupMap.get("productgroupid") )%>&quarter=<custom:write property='quarter'/>&year=<custom:write property='year'/>&level1=<%=JspHelper.filterNull( userGroupMap.get("level1") )%>"><%=JspHelper.filterNull( userGroupMap.get("plancount") )%></a></td>
        <%} %>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("deptcount") )%></td>
        <%if((JspHelper.filterNull( subjectcode ).equals("920")) ||  (JspHelper.filterNull( subjectcode ).equals("921"))  ) { %>
        <td class="title_center">
         <%if(userGroupMap.get("deptcount")!= null){ %>
           <%if(((Integer)userGroupMap.get("differencetype")).intValue()==1){%>
           <custom:write name="usergroup" property="differencetype" dictType="QualifiedType" nbsp="true"/>
           <%} %>
           <%if(((Integer)userGroupMap.get("differencetype")).intValue()==2){%>
             <FONT style="color: red;">较标准还需上报<%=JspHelper.filterNull( userGroupMap.get("margincount") )%>客户！！</FONT>
           <%} %>
            <%if(((Integer)userGroupMap.get("differencetype")).intValue()==3){%>
            <FONT style="color: red;"><custom:write name="usergroup" property="differencetype" dictType="QualifiedType" nbsp="true"/></FONT>
           <%} %>
           <%}else{ %>
            <FONT style="color: red;">部门标准不存在！</FONT>
           <%} %>
        </td>
        <%} %>
        <custom:hidden name="usergroup" property="differencetype" colIndex="<%=idx %>"/>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("datelastupdated") )%></td>
    </tr>
    </logic:iterate>  
    <input type="hidden" name="batchno" value="<%=JspHelper.filterNull( nDefaultbatchno )%>">
    </table>
    <%} %>
    <!-- 总部标准 -->
    <%if(standardtype.intValue()==2){ %>
    <custom:hidden  property="equationtype1" />
   	<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="0">
   	<% //--------------------------------------  summary header --%>
   	<tr bgcolor="#ACBCCA"  class="deepblue-left" > 
   		<td width="1%" class="title_center" >
   		  <%if(userGroupSummary.size() > 0){ %>
			&nbsp;<input type="checkbox" name="checkallbox" class="checkbox"  onclick="allcheckselect()">
		  <%}else{ %>
			&nbsp;
		  <%} %>
   		</td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_Provicetdr") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_Department") %></td>
       	<td width="6%" class="title_center" ><%= label.getLabelName("L_RegionOffice") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_Manager") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_Variety") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_Grade") %></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_Type") %></td>
       	<td width="5%" class="title_center" ><%= label.getLabelName("L_LockNumber") %></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_PlanNumber") %></td>
       	<td width="8%" class="title_center" ><%= label.getLabelName("L_QuarterDevelopmentGoals")+" / "+label.getLabelName("L_QuarterCumulativeRate")%></td>
       	<td width="3%" class="title_center" ><%= label.getLabelName("L_HeadquartersStandard") %></td>
       	<td width="6%" class="title_center" ><%= label.getLabelName("L_TurnoverTime") %></td>
       	<td width="6%" class="title_center" ><%= label.getLabelName("L_ErrorMsg") %></td>
    </tr>
	<% //--------------------------------------  default value definition --%>
    <%
    	int i=1;
        Integer nDefaultbatchno = new Integer(-1);               
        String strClassType = new String(); 
        boolean bHasChecked = false;
        String strDefaultIsDisabled="";
        String strDefaultmdapprovalgroupname=""; 
        String nDefaultbatchcode = "";
   	%>
    <logic:iterate id="usergroup" collection="<%= userGroupSummary %>" indexId="idx">                      
    	
    <%
    	HashMap userGroupMap = (HashMap)pageContext.getAttribute("usergroup"); 
        String strIsDisabled = "";
        String strIsChecked = "";
        boolean selectDisabled1=false;
        //out.print(((Integer)userGroupMap.get("count40")).intValue()!=0);
        if((JspHelper.filterNull( subjectcode ).equals("920")) ||  (JspHelper.filterNull( subjectcode ).equals("921"))  ) {
           if(userGroupMap.get("unit")==null ){//总部标准未维护置灰
        	   selectDisabled1=true;
           }else if(userGroupMap.get("totalqty")==null ){
        	   selectDisabled1=true; //锁定家数未找到
           }else{
        	  if(((Integer)userGroupMap.get("unit")).equals(new Integer(6)) && ((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(3))){
        	   selectDisabled1=true; //总部维护的百分比无逻辑！
        	  }
           }
           if(userGroupMap.get("unit")!=null && ((Integer)userGroupMap.get("unit")).equals(new Integer(4))) {//人 计划数 总部标准
        	   if(!(String.valueOf((Integer)userGroupMap.get("plancount"))).equals((String)userGroupMap.get("qty"))){
         		  selectDisabled1=true;//人 计划数 总部标准
         	   }
           }
           if(userGroupMap.get("unit")!=null){
               if(!(String.valueOf((Integer)userGroupMap.get("plancount"))).equals((String)userGroupMap.get("qty")) && ((Integer)userGroupMap.get("unit")).equals(new Integer(4))){
            	   selectDisabled1=true; 
               }else{
                if(userGroupMap.get("totalqty")!=null && ((Integer)userGroupMap.get("unit")).equals(new Integer(6))){
                   double qty=(Double.parseDouble((String)userGroupMap.get("qty"))*10);
                   double qty1=(Double.parseDouble((String)userGroupMap.get("qty1"))*10);
                   double qty2=(Double.parseDouble((String)userGroupMap.get("qty2"))*10);
                  if(((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(1))){//该季度上报计划开发终端家数/该季度未开发终端数 百分比四舍五入比较
                    if((float)Math.round(qty)/10 != (float)Math.round(qty1)/10){
                    	selectDisabled1=true; 
                    }
                  }
                  if(((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(2))){//该季度末已开发终端数/本年度锁定终端总数 百分比四舍五入比较
                     if((float)Math.round(qty)/10 != (float)Math.round(qty2)/10){
                    	 selectDisabled1=true; 
                     }
                  }
                 }
               }
           }
        }
        if((JspHelper.filterNull( subjectcode ).equals("820")) ||  (JspHelper.filterNull( subjectcode ).equals("821"))  ) {
            if(((Integer)userGroupMap.get("lowercount20")).intValue()==0){
          	    selectDisabled1=true;
            }
        }
        if(i%2==0){
            strClassType="td-listrom";
        } else{
            strClassType="none";
        } 
       if(!bHasChecked)
        {
	        strIsChecked = "Checked";                       
            bHasChecked = true;
          	strDefaultIsDisabled = strIsDisabled;   
        }  
       i++;
  	%>
  	
  	
    <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"   class="title_center">
    	<td class="title_center">
    	  &nbsp;<custom:checkbox property="busprostr" name="usergroup" changedName="batchnoidstr" styleClass="normalradio" disabled="<%=selectDisabled1 %>" />
        </td>
        <!--终端计划审批-->
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("area1name") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("deptname") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("area2name") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("employeename") )%></td>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("productgroupname") )%></td>
        <%if((JspHelper.filterNull( subjectcode ).equals("820")) || (JspHelper.filterNull( subjectcode ).equals("920")) ) {%>
          <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("organalysisattr2") )%></td>
        <%} %>
        <%if((JspHelper.filterNull( subjectcode ).equals("821")) || (JspHelper.filterNull( subjectcode ).equals("921")) ) {%>
          <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("organalysisattr3") )%></td>
        <%} %>
        <td class="title_center"><custom:write name="usergroup" property="unit" dictType="UomType" nbsp="true"/></td>
        <td class="title_center"><custom:write name="usergroup" property="totalqty" nbsp="true"/></td>
        <%if((JspHelper.filterNull( subjectcode ).equals("820")) || (JspHelper.filterNull( subjectcode ).equals("821")) || (JspHelper.filterNull( subjectcode ).equals("920")) ||  (JspHelper.filterNull( subjectcode ).equals("921"))  ) {%>
        <td class="title_center">&nbsp;
           <a href="<%=contextPath %>/zylprocessgoals/ApprovalZylReportPlanDetail.jsp?<%= OvalTools.randomURL() %>&businessareaid=<%=JspHelper.filterNull( userGroupMap.get("businessareaid") )%>&subjectcode=<%=subjectcode %>&contactid=<%=JspHelper.filterNull( CurUserInfo.get("userid") )%>&productgroupid=<%=JspHelper.filterNull( userGroupMap.get("productgroupid") )%>&quarter=<custom:write property='quarter'/>&year=<custom:write property='year'/>&level1=<%=JspHelper.filterNull( userGroupMap.get("level1") )%>">
              <custom:write name="usergroup" property="plancount"  nbsp="true"/>
           </a>
        </td>
        <%} %>
        <custom:hidden name="usergroup" property="plancount"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="unit"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="qty"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="qty1"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="qty2"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="uqty1"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="uqty2"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="totalqty"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="developqty"  colIndex="<%=idx %>"/>
        <custom:hidden name="usergroup" property="udevelopqty"  colIndex="<%=idx %>"/>
        <%
         //java.text.DecimalFormat df = new java.text.DecimalFormat();
         //df.setMaximumFractionDigits(2);
         //df.setMinimumFractionDigits(2);
         //int a =0;//计划数 out.print(df.format(a * 100.00 / b) + "%");
         //int b =0;//未开发数
         //int c=0;//已开发数
         //int d=0;//锁定数
         //unit=4 人  unit=6百分比
        %>
        <td class="title_center">
         <%if(userGroupMap.get("unit")!=null ){ %>
           <%if(((Integer)userGroupMap.get("unit")).equals(new Integer(4))) {%>
            <custom:write name="usergroup" property="plancount" nbsp="true"/>
           <%} %>
           <%if(((Integer)userGroupMap.get("unit")).equals(new Integer(6))) {%>
             <%if(((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(1))) { 
             %>
                <custom:write name="usergroup" property="qty1"  nbsp="true"/>%
             <% 
             } %>
             <%if(((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(2))) {%> 
                <custom:write name="usergroup" property="qty2"  nbsp="true"/>%
             <%} %>
           <%} %>
         <%} %>
         &nbsp;
        </td>
        <td class="title_center">
        <%if(userGroupMap.get("unit")!=null ){ %>
         <%if(((Integer)userGroupMap.get("unit")).equals(new Integer(4))) {%>
           <custom:write name="usergroup" property="qty"  nbsp="true"/>
         <%} %>
         <%if(((Integer)userGroupMap.get("unit")).equals(new Integer(6))) {%>
           <custom:write name="usergroup" property="qty"  nbsp="true"/>%
         <%} %>
        <%} %>
        &nbsp;
        </td>
        <custom:hidden name="usergroup" property="differencetype" colIndex="<%=idx %>"/>
        <td class="title_center">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("datelastupdated") )%></td>
        <td class="title_center">&nbsp;
            <%if(userGroupMap.get("unit")==null ){ %>
               <font color="red"><%=message.getMessageDesc("A_HeadquartersStandardMaintenance") %></font>
            <%}else{ %>
              <%if(userGroupMap.get("totalqty")==null ){ %>
                <font color="red"><%=message.getMessageDesc("A_LockNumberNotFound") %></font>
              <%}else{
            	if(((Integer)userGroupMap.get("unit")).equals(new Integer(6)) && ((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(3))){
              %> 
                <font color="red"><%=message.getMessageDesc("A_headquartersMaintenanceWithoutLogic") %></font>
              <%		
            	}
              }%>
             <%if((JspHelper.filterNull( subjectcode ).equals("920")) || (JspHelper.filterNull( subjectcode ).equals("921")) ) {%>
               <%if(!(String.valueOf((Integer)userGroupMap.get("plancount"))).equals((String)userGroupMap.get("qty")) && ((Integer)userGroupMap.get("unit")).equals(new Integer(4)) && userGroupMap.get("totalqty")!=null){%>
                <font color="red">未合格不允许导入!</font>
               <%}else{
            	if(userGroupMap.get("totalqty")!=null && ((Integer)userGroupMap.get("unit")).equals(new Integer(6))){
            	  double qty=(Double.parseDouble((String)userGroupMap.get("qty"))*10);
                  double qty1=(Double.parseDouble((String)userGroupMap.get("qty1"))*10);
                  double qty2=(Double.parseDouble((String)userGroupMap.get("qty2"))*10);
                  if(((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(1))){//该季度上报计划开发终端家数/该季度未开发终端数 百分比四舍五入比较
                   if((float)Math.round(qty)/10 != (float)Math.round(qty1)/10){
                	   //System.out.println((float)Math.round(qty)/10+" "+(String)userGroupMap.get("qty"));
                   	   //System.out.print((float)Math.round(qty1)/10+" "+(String)userGroupMap.get("qty1"));
                   	   //System.out.print((float)Math.round(qty2)/10+" "+(String)userGroupMap.get("qty2"));
                	 %>
                	 <font color="red">未合格不允许导入!</font>
                	 <%
                   }
                  }
                  
                  if(((Integer)pageContext.getAttribute("equationtype1")).equals(new Integer(2))){//该季度末已开发终端数/本年度锁定终端总数 百分比四舍五入比较
                      if((float)Math.round(qty)/10 != (float)Math.round(qty2)/10){
                        %>
                        <font color="red">未合格不允许导入!</font>
                       <%
                     }
                  }
            	}
              %>
             <%}%>
             <%}%>
            <%}%>
        </td>
    </tr>
    </logic:iterate>  
       <input type="hidden" name="batchno" value="<%=JspHelper.filterNull( nDefaultbatchno )%>">
    </table>
    <%} %>
    <%@ include file="/inc/SummaryAction.inc" %>
    <% //--------------------------------------  page operation button --%>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr> 
        	<td class="summary_top" ></td>
        </tr>
		<%if(standardtype.intValue()!=-1){ %>
        <tr> 
        	<td class="td_center"> 
			<% if (subjectcode.equals("920") ||subjectcode.equals("921")){ %>
			   <a onclick="page_report()"><custom:button type="1" label="L_Import" imgsrc="delete.gif" border="0" style="width:60" /></a>
			   <!-- <a onclick="page_done('stop')"><custom:button type="1" label="L_Stop" imgsrc="Agree.gif" border="0" style="width:60"/></a> -->
			<%} %>
			<% if (subjectcode.equals("820") || subjectcode.equals("821")){ %>
             <a onclick="page_done('agree')"><custom:button type="1" label="L_Agree" imgsrc="Agree.gif" border="0" style="width:60"/></a>
             <a onclick="page_done('deny')"><custom:button type="1" label="L_Deny" imgsrc="deny.gif" border="0" style="width:60"/></a>
            <%} %>
        	</td>
        </tr>
        <%} %>
  	</table>
</form>
</body>
</html>


